package com.sigmatrix.h5.web.rebate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sigmatrix.h5.service.ShortMessageService;
import com.sigmatrix.h5.service.common.ServiceHelper;
import com.sigmatrix.h5.utils.CommonUtils;
import com.sigmatrix.h5.utils.SessionUtils;
import com.sigmatrix.h5.web.BaseController;
import com.sigmatrix.h5.web.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 *@ClassName: ShortMessageController
 *@Description: 短信接口
 *@author MH
 *@date 2017年12月14日 下午1:28:42
 */
@Api(tags="短信接口")
@RestController
@RequestMapping("/rebate/api/sms")
public class ShortMessageController extends BaseController{
	
//	@Autowired
//	private ShortMessageService shortMessageService;
	
	@ApiOperation("发送验证码短信")
	@PostMapping("/vercode")
	public Result<Void> sendVerification(String phoneNumber){
		if(!CommonUtils.isCellPhoneNumber(phoneNumber)){
			return error("请输入正确的手机号");
		}
		ServiceHelper.selectSmsService(SessionUtils.getEseCode()).sendVerificationCode(phoneNumber);
		return ok(null);
	}
	
}
